#ifndef __valve_H
#define __valve_H

#include <stdint.h>

#define	REG_VALVE_BAS_ADDR  600 

enum 
{
  valve_type,
	port1_sensor_type,
	port1_sensor_Interface_type,
	port1_sensor_range,
	null,
	port2_sensor_type,
	port2_sensor_Interface_type,
	port2_sensor_range,
	null1,

	zero_angle,
  set_port1_opening,
	set_port2_opening,
  close_valve,

	valve_angle,
	bat_v,
  port1_sensor_value,
	port2_sensor_value,
  inport_sensor1_value,
	inport_sensor2_value,
  port3_sensor_value,
	port4_sensor_value,
};

struct S_REG_VALVE
{
  uint16_t  valve_type;
	uint16_t  port1_sensor_type;
	uint16_t  port1_sensor_Interface_type;
	uint16_t  port1_sensor_range;
	uint16_t  null;
	uint16_t  port2_sensor_type;
	uint16_t  port2_sensor_Interface_type;
	uint16_t  port2_sensor_range;
	uint16_t  null1;

	uint16_t  zero_angle;
  uint16_t  set_port1_opening;
	uint16_t  set_port2_opening;
  uint16_t  close_valve;

  uint16_t  current_angle;
	uint16_t  bat_v;
  uint16_t  port1_sensor_value;
	uint16_t  port2_sensor_value;
  uint16_t  inport_sensor1_value;
	uint16_t  inport_sensor2_value;
  uint16_t  port3_sensor_value;
	uint16_t  port4_sensor_value;
};

enum 
{	
  VALVE_ONE_WAY,
  VALVE_TWO_WAY,
} ;

extern struct S_REG_VALVE s_reg_valve;

uint16_t get_valve_current_angle(void);
void valve_age_task(void) ; 
uint8_t valve_task(void) ; 
uint8_t  sw_valve(uint16_t reg_addr_index, uint16_t msg);
#endif
